package cashpointer.core.results;

import cashpointer.core.support.ContextStore;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.Result;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Klasa wspomaga wyswietlanie podsumowania poprawnie wykonanej akcji.
 * @author wojciech topolski
 * @version 2009-03-25
 */
public class ShowResult implements Result {
    public void execute(ActionInvocation arg0) throws Exception {
        // Pobranie contextu Springa.
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");

        // Pobranie contextStoreBean.
        ContextStore contextStoreBean = (ContextStore) ctx.getBean("contextStoreBean");
        
        if (contextStoreBean.getOutputMode()) {
            System.out.println(contextStoreBean.getMSG());
            System.out.println("Zakonczono pomyslenie.");
        }
    }
}